/*
 * Copyright 2015 CPE Lyon - IRC 2013/2016 - Cours de programmation réseau - Groupe H
 *
 * This file is part of BOTT.
 *
 * BOTT is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 *
 * BOTT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with BOTT. If not, see http://www.gnu.org/licenses/.
 */

/*
 * Fonctions génériques.
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "protocole.h"
#include "fonctions.h"

/* Vérifier que l'ID de commande est correct (coté serveur) */
int checkClientCommand(int16_t idCommand) {
    int find = 0;
    for (size_t i = 0; i < sizeof(clientCommands) ; i++) {
        if (clientCommands[i] == idCommand) {
            find = 1;
            break;
        }
    }
    return find;
}

/* Vérifier que l'ID de commande est correct (coté client) */
int checkServerCommand(int16_t idCommand) {
    int find = 0;
    for (size_t i = 0; i < sizeof(serverCommands) ; i++) {
        if (serverCommands[i] ==  idCommand) {
            find = 1;
            break;
        }
    }
    return find;
}

/* Remettre les commandes par défaut */
void clearColors() {
    printf("%s", RESETCOLOR);
}